package com.mymall.serve.serviceimpl;

import com.mymall.serve.entity.MallUser;
import com.mymall.serve.service.MallUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * 用户操作service类
 *
 * @author weiwei
 * @since 2020-04-12 13:39
 **/
@Slf4j
@Service
public class UserServiceImpl {

    @Autowired
    private MallUserService mallUserService;

    @Cacheable(unless = "#result==null",cacheNames = "fiveMinuteCache",key = "#root.methodName.concat(':').concat(#openId)")
    public MallUser getLoginUserByOpenId(String openId) {
        return mallUserService.getUserByOpenId(openId);
    }
}
